package com.example.dataView.controller;



import com.example.dataView.common.result.R;
import com.example.dataView.service.SchoolInfoService;
import io.swagger.annotations.*;
import lombok.RequiredArgsConstructor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author 成大事
 * @since 2022-06-09 20:26:57
 */
@Api(tags = "学校信息")
@Validated
@RestController
@RequestMapping("/schoolInfo")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class SchoolInfoController {

    private final SchoolInfoService schoolInfoService;


    @ApiOperation(value = "中国地图各个省份的高校的数量")
    @PostMapping("/getProvinceSchoolNum")
    @ApiResponses({
            @ApiResponse(code = 200,message = "成功"),
            @ApiResponse(code = 500,message = "错误"),
    })
    public R<Object> getProvinceSchoolNum(){
        return schoolInfoService.getProvinceSchoolNum();
    }



    @ApiOperation(value = "根据省份获取这个省份的高校")
    @PostMapping("/getSchoolNumByProvinceId")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "province", value = "省份的名称", dataTypeClass = String.class, paramType = "query"),
    })
    @ApiResponses({
            @ApiResponse(code = 200,message = "成功"),
            @ApiResponse(code = 500,message = "错误"),
    })
    public R<Object> getSchoolNumByProvinceId(
            @RequestParam("province") String province
    ){
        return schoolInfoService.getSchoolNumByProvinceId(province);
    }




}

